package com.yun.cloud.controller;

import com.yun.cloud.entity.Dept;
import com.yun.cloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lsy
 * on 2018/6/8 15:33.
 */
@RestController
public class DeptControllerConsumer {

    @Autowired
    private DeptClientService clientService;

    @RequestMapping(value = "/consumer/dept/add", method = RequestMethod.GET)
    public boolean add(Dept dept) {
        return this.clientService.add(dept);
    }
    @RequestMapping(value = "/consumer/dept/get/{id}", method = RequestMethod.GET)
    public Dept get(@PathVariable("id") Long id) {
        return this.clientService.get(id);
    }
    @RequestMapping(value = "/consumer/dept/list", method = RequestMethod.GET)
    public List<Dept> list() {
        return this.clientService.list();
    }
    @RequestMapping(value = "/consumer/dept/discovery", method = RequestMethod.GET)
    public Object discovery() {
        return this.clientService.discovery();
    }
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }
}
